load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "syncutil",
    srcs = [
        "atomic.go",
        "map.go",
        "mutex_deadlock.go",  # keep
        "mutex_sync.go",  # keep
        "mutex_sync_race.go",  # keep
        "mutex_tracing.go",
        "set.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/util/syncutil",
    visibility = ["//visibility:public"],
    deps = [
        "@com_github_sasha_s_go_deadlock//:go-deadlock",  # keep
    ],
)

go_test(
    name = "syncutil_test",
    size = "small",
    srcs = [
        "atomic_test.go",
        "map_bench_test.go",
        "map_reference_test.go",
        "map_test.go",
        "mutex_sync_race_test.go",  # keep
        "mutex_tracing_test.go",
        "set_test.go",
    ],
    embed = [":syncutil"],
    deps = ["@com_github_stretchr_testify//require"],
)
